<<!include:header>>
    <section class="hero-section litte-header">
        <div class="container">
            <div class="filtrate mb40 ft15    ">
                <div class="filtrate mb40 ft15   " style="margin-top:150px;color:#fff">

                </div>
            </div>
        </div>

    </section><!-- End Hero -->
    <div class="container" style="margin-top:50px;margin-bottom: 50px;">
        <div class="row">
            <h2 style="width: 100%;" class="text-center">支付成功，立即开启学习之旅吧！</h2>

        </div>
        <div class="row" style="margin-top:20px;margin-bottom: 20px;">
            <div id="courseLabel" class="col-xs-12 col-md-6   col-lg-6 text-left"></div>
            <div id="tradeNoLabel" class="col-xs-12  col-md-6 text-right"></div>
        </div>

        <div class="row" style="margin-top:20px;margin-bottom: 20px;">
            <table class="table  ">

                <thead>
                    <tr>
                        <th>编号</th>
                        <th>教材名称</th>
                        <th>学习周期</th>
                        <th>支付方式</th>
                    </tr>
                </thead>
                <tbody id="bookList">

                </tbody>
            </table>
        </div>
        <div class="row text-center" id="buyTime" style="margin-top:20px;margin-bottom: 20px;">

        </div>
        <div class="row text-center" style="margin-top:100px;margin-bottom: 100px;">
            <a class="nav-link  col-sm-6 text-right" style="cursor:pointer" onclick="goOtherPage('/')">返回首页</a>
            <a class="nav-link  col-sm-6  text-left" style="cursor:pointer" onclick="goOtherPage('/user/')">我的学习中心</a>
        </div>

    </div>
    <script src="https://cdn.bootcdn.net/ajax/libs/axios/0.20.0-0/axios.min.js"></script>
    <script>
        var query = window.location.search.substring(1);
        var vars = query.split("&");
        for (var i = 0; i < vars.length; i++) {
            var pair = vars[i].split("=");
            if (pair[0] == "id") {
                id = pair[1];
                break;
            }
        }

        axios.get('/api/pay/getFinishPayData/' + id)
            .then(function (response) {
                var res = response.data;
                if (res.code != 200) {

                    alert(res.title)
                    return;
                }
                document.getElementById("courseLabel").innerHTML = "课程名称:[" + res.title + "].共包含以下教材:";
                var bookListStr = "";
                if (res.data.Children) {

                    for (var i = 0; i < res.data.Children.length; i++) {
                        var item = res.data.Children[i];
                        bookListStr += ("<tr><th>" + item.index + "</th>" + "<th>" + item.bookName + "</th>" + "<th>" + item.AddTime + "</th>" + "<th>" + item.FangshiPrice + "</th></tr>")
                    }
                }
                document.getElementById("bookList").innerHTML = bookListStr;

                document.getElementById("tradeNoLabel").innerHTML = "订单编号:" + res.data.OrderNum;
                document.getElementById("buyTime").innerHTML = "  购买日期:" + res.data.Time;

            })

        function goOtherPage(url) {
            window.location.href = url;

        }
    </script>
    <<!include:footer>>